package com.pzb.goods.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pzb.goods.mapper.GdGoodsUnitsKeyMapper;
import com.pzb.goods.domain.GdGoodsUnitsKey;
import com.pzb.goods.service.IGdGoodsUnitsKeyService;

/**
 * 商品规格Service业务层处理
 * 
 * @author Mr_Wu
 * @date 2021-12-08
 */
@Service
public class GdGoodsUnitsKeyServiceImpl implements IGdGoodsUnitsKeyService 
{
    @Autowired
    private GdGoodsUnitsKeyMapper gdGoodsUnitsKeyMapper;

    /**
     * 查询商品规格
     * 
     * @param id 商品规格主键
     * @return 商品规格
     */
    @Override
    public GdGoodsUnitsKey selectGdGoodsUnitsKeyById(Long id)
    {
        return gdGoodsUnitsKeyMapper.selectGdGoodsUnitsKeyById(id);
    }

    /**
     * 查询商品规格列表
     * 
     * @param gdGoodsUnitsKey 商品规格
     * @return 商品规格
     */
    @Override
    public List<GdGoodsUnitsKey> selectGdGoodsUnitsKeyList(GdGoodsUnitsKey gdGoodsUnitsKey)
    {
        return gdGoodsUnitsKeyMapper.selectGdGoodsUnitsKeyList(gdGoodsUnitsKey);
    }

    /**
     * 新增商品规格
     * 
     * @param gdGoodsUnitsKey 商品规格
     * @return 结果
     */
    @Override
    public int insertGdGoodsUnitsKey(GdGoodsUnitsKey gdGoodsUnitsKey)
    {
        return gdGoodsUnitsKeyMapper.insertGdGoodsUnitsKey(gdGoodsUnitsKey);
    }

    /**
     * 修改商品规格
     * 
     * @param gdGoodsUnitsKey 商品规格
     * @return 结果
     */
    @Override
    public int updateGdGoodsUnitsKey(GdGoodsUnitsKey gdGoodsUnitsKey)
    {
        return gdGoodsUnitsKeyMapper.updateGdGoodsUnitsKey(gdGoodsUnitsKey);
    }

    /**
     * 删除商品规格信息
     * 
     * @param id 商品规格主键
     * @return 结果
     */
    @Override
    public int deleteGdGoodsUnitsKeyById(Long id)
    {
        return gdGoodsUnitsKeyMapper.deleteGdGoodsUnitsKeyById(id);
    }

    /**
     * 查询商品规格列表
     *
     * @param gdGoodsUnitsKey 商品规格
     * @return 商品规格集合
     */
    @Override
    public List<GdGoodsUnitsKey> selectGdGoodsUnitsKeyValueList(GdGoodsUnitsKey gdGoodsUnitsKey) {
        return gdGoodsUnitsKeyMapper.selectGdGoodsUnitsKeyValueList(gdGoodsUnitsKey);
    }

    @Override
    public boolean checkUnitsKeyExistValues(Long id) {
        int count = gdGoodsUnitsKeyMapper.checkUnitsKeyExistValues(id);
        return count > 0 ? true : false;
    }
}
